home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / C / LIB / UNIXLIB37B / !UnixLib37 / src / unix / c / sync < prev    next >
Text File  |  1996-11-09  |  1KB  |  70 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /unixb/home/unixlib/source/unixlib37/src/unix/c/RCS/sync,v $
  4.  * $Date: 1996/11/06 22:01:42 $
  5.  * $Revision: 1.3 $
  6.  * $State: Rel $
  7.  * $Author: unixlib $
  8.  *
  9.  * $Log: sync,v $
  10.  * Revision 1.3  1996/11/06 22:01:42  unixlib
  11.  * Yet more changes by NB, PB and SC.
  12.  *
  13.  * Revision 1.2  1996/10/30 22:04:51  unixlib
  14.  * Massive changes made by Nick Burret and Peter Burwood.
  15.  *
  16.  * $Log: sync,v $
  17.  * Revision 1.3  1996/11/06 22:01:42  unixlib
  18.  * Yet more changes by NB, PB and SC.
  19.  *
  20.  * Revision 1.1  1996/04/19 21:35:27  simon
  21.  * Initial revision
  22.  *
  23.  ***************************************************************************/
  24.  
  25. static const char rcs_id[] = "$Id: sync,v 1.3 1996/11/06 22:01:42 unixlib Rel $";
  26.  
  27. #include <errno.h>
  28. #include <unistd.h>
  29. #include <sys/os.h>
  30. #include <sys/dev.h>
  31. #include <sys/unix.h>
  32.  
  33. int
  34. sync (void)
  35. {
  36.   int r[3];
  37.   _kernel_oserror *e;
  38.  
  39.   if (e = os_args (0xff, 0, 0, r))
  40.     {
  41.       __seterr (e);
  42.       return (-1);
  43.     }
  44.  
  45.   return (0);
  46. }
  47.  
  48. int
  49. fsync (int fd)
  50. {
  51.   int r[3];
  52.   _kernel_oserror *e;
  53.   register struct file *f;
  54.  
  55.   if (BADF (fd))
  56.     {
  57.       errno = EBADF;
  58.       return -1;
  59.     }
  60.  
  61.   f = __u->file + fd;
  62.   if (e = os_args (0xff, minor (f->dev), 0, r))
  63.     {
  64.       __seterr (e);
  65.       return -1;
  66.     }
  67.  
  68.   return 0;
  69. }
  70.